package com.platform.wechat.controller;

import com.alibaba.fastjson.JSON;
import com.platform.wechat.common.JsonBean;
import com.platform.wechat.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author YP
 * @company ~~
 * @create 2021-07-31 17:25
 */
@RestController
@RequestMapping("doctor")
public class DoctorController {

    @Autowired
    private DoctorService doctorService;

    @RequestMapping("getDoctor")
    public JsonBean getDoctor(Integer id){

        return doctorService.selectDoctorById(id);
    }

    @RequestMapping("getDoctorByTime")
    public JsonBean getDoctorByTime(String workingTime){
        JsonBean jsonBean = doctorService.selectDoctorByWorkingTime(workingTime);
        //System.err.println(jsonBean);
        return jsonBean;
    }

    @RequestMapping("getDoctorForReg")
    public JsonBean getDoctorForReg(Integer id){
        JsonBean jsonBean = doctorService.selectDoctorForReg(id);
        //System.err.println(jsonBean);
        return jsonBean;
    }


    /** 
    * @Description: 根据医院Id和科室Id查医生集合
    * @Param: [hospitalId, officesId] 
    * @return: com.platform.wechat.common.JsonBean 
    * @Author: guopeixin
    * @Date: 2021/8/2 22:11
    */
    @RequestMapping("getDoctorByHosAndOffId")
    public JsonBean getDoctorByHosAndOffId(Integer hospitalId, Integer officesId){
        JsonBean jsonBean = doctorService.selectDoctorByHosAndOffId(hospitalId, officesId);
        System.err.println(jsonBean);
        return jsonBean;
    }

    /**
    * @Description:  显示专家部分
    * @Param: [hospitalId, officesId, doctorId]
    * @return: com.platform.wechat.common.JsonBean
    * @Author: guopeixin
    * @Date: 2021/8/3 14:50
    */
    @RequestMapping("selectDoctorByHosAndOffIdAndDoctorId")
    public JsonBean selectDoctorByHosAndOffIdAndDoctorId(Integer hospitalId, Integer officesId, Integer doctorId){
        JsonBean jsonBean = doctorService.selectDoctorByHosAndOffIdAndDoctorId(hospitalId, officesId, doctorId);
        //System.err.println(jsonBean);
        return jsonBean;
    }

    /** 
    * @Description: 时间段中有工作安排的医生
    * @Param: [hospitalId, officesId, doctorId] 
    * @return: com.platform.wechat.common.JsonBean 
    * @Author: guopeixin
    * @Date: 2021/8/3 15:11
    */
    @RequestMapping("selectWorkDoctors")
    public JsonBean selectWorkDoctors(Integer hospitalId, Integer officesId, Integer doctorId){
        JsonBean jsonBean = doctorService.selectWorkDoctors(hospitalId, officesId, doctorId);
        //System.err.println(jsonBean);
        return jsonBean;
    }


}
